﻿
Imports Moca.Di

Public Class HomeController
	Inherits System.Web.Mvc.Controller

	' ''' <summary>ページに対しての依存性注入</summary>
	'Private _injector As MocaInjector

	''' <summary>Session Access</summary>
	Protected sessionState As Web.ISession

	''' <summary>ViewData Model Access</summary>
	Protected model As IViewData

	''' <summary>Database Access</summary>
	Protected dao As Db.IDaoSample

	'#Region " コンストラクタ／デストラクタ "

	'	''' <summary>
	'	''' コンストラクタ
	'	''' </summary>
	'	''' <remarks></remarks>
	'	Public Sub New()
	'		' 属性による依存性の注入
	'		_injector = New MocaWebMvcInjector()
	'		_injector.Inject(Me)
	'	End Sub

	'	''' <summary>
	'	''' デストラクタ
	'	''' </summary>
	'	''' <remarks></remarks>
	'	Protected Overrides Sub Finalize()
	'		MyBase.Finalize()
	'		_injector.DaoDispose(Me)
	'	End Sub

	'#End Region

	'
	' GET: /Home

	Function Index() As ActionResult
		model.Title = "Index Page"

		If Me.Session.IsNewSession Then
			sessionState.Id = 0
		End If
		sessionState.Id += 123

		model.Msg = dao.GetValue(sessionState.Id)

		Return View(model)
	End Function

End Class
